<template>
  <div>
    <van-nav-bar title="" left-text="" left-arrow @click-left="onClickLeft">
    </van-nav-bar>
    <div class="class">{{ this.$route.meta.title }}</div>
    <div class="Recommended_box_container">
      <div class="Recommended_box" v-for="(item, index) in list" :key="index">
        <div class="title_box">
          <span>{{ item.course_classify_title }}</span>
        </div>
        <div class="content_box">
          <div class="top_box">
            <div class="font">{{ item.title }}</div>
            <div class="model">
              <div v-for="(item2, index) in item.course_label" :key="index">
                <button class="title">{{ item2.label_name }}</button>
              </div>
            </div>
          </div>
          <div class="bottom">
            <div class="HeadPortrait">
              <div
                v-for="(item2, index) in item.teacher"
                :key="index"
                v-show="index < 3"
              >
                <img :src="item2.avatar" alt="" />
                <p>{{ item2.teacher_name }}</p>
              </div>
            </div>
            <div class="buttom_title">
              <div>{{ item.sales_num }}人已报名</div>
              <div>免费</div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="dd"></div>
  </div>
</template>

<script>
import { getPublic } from "../../http/api";
export default {
  data() {
    return {
      list: [],
      text: "免费",
      ishow: true,
      title: "",
    };
  },
  created() {
    this.getPublics();
  },
  methods: {
    async getPublics() {
      const res = await getPublic(this.$store.state.CategoryId);
      console.log(res);
      this.title = res.data.data.model_name;
      this.list = res.data.data.course_list;
      // this.getClassify();
    },
    onClickLeft() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="scss" scoped>
.class {
  width: 100px;
  font-size: 20px;
  position: absolute;
  top: 18px;
  left: 150px;
  z-index: 666;
  font-weight: 700;
}
// 推荐好课
.Recommended_box_container {
  width: 100%;
  height: 100%;
  background-color: #fafafa;
  .Recommended_title {
    width: 95%;
    height: 1.5rem;
    // background-color: rebeccapurple;
    margin: 0 auto;
    font-size: 20px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
  }
  .Recommended_box {
    width: 95%;
    height: 4rem;
    background-color: #fff;
    margin: 0 auto;
    border-radius: 20px;
    margin-top: 10px;
    .title_box {
      width: 75px;
      height: 25px;
      background-color: #ff8800;
      color: #fff;
      border-radius: 25px 9px 25px 9px;
      font-size: 12px;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .content_box {
      width: 90%;
      height: 85%;
      //   background-color: springgreen;
      margin: 5px auto 0;
      .top_box {
        width: 100%;
        height: 50%;
        // background-color: steelblue;
        .font {
          width: 100%;
          height: 70%;
          font-size: 18px;
          //   background-color: rgb(207, 135, 235);
        }
        .model {
          width: 100%;
          height: 30%;
          display: flex;
          justify-content: flex-start;
          //   background-color: pink;
        }
        .model div {
          height: 100%;
          display: flex;
        }
        .title {
          //   width: 150px;
          height: 100%;
          font-size: 8px;
          border: none;
          outline: none;
          border-radius: 10px;
          margin-left: 5px;
          //   float: left;
        }
      }
      .bottom {
        width: 100%;
        height: 50%;
        // background-color: skyblue;
        .HeadPortrait {
          width: 100%;
          height: 50%;
          // background-color: darkblue;
          border-bottom: 1px solid #ccc;
          display: flex;
          justify-items: center;
          img {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            vertical-align: middle;
            float: left;
            margin-top: 10px;
            margin-left: 10px;
          }
          p {
            font-size: 16px;
            float: left;
            margin-top: 20px;
          }
        }
        .buttom_title {
          width: 100%;
          height: 50%;
          // background-color: slateblue;
          display: flex;
          justify-content: space-between;
          align-items: center;
        }
        .buttom_title div {
          font-size: 16px;
        }
        .buttom_title div:nth-child(2) {
          font-size: 18px;
          color: green;
        }
      }
    }
  }
}
.dd {
  width: 100%;
  height: 1.5rem;
}
</style>